# @shuaige : 陈世玉
# @name :test2.py
# @time :2025/3/4 18:32
import numpy as np
import csv

import pandas as pd

# 获取数据
data=[]
with open("iris.csv") as csvfile:
    csv_reader=csv.reader(csvfile)
    birth_header=next(csv_reader)
    for row in csv_reader:
        data.append(row)
    # print (data)

# 数据清理
iris_list=[]
for row in data:
    iris_list.append(tuple(row[1:]))
# print(iris_list)

# 创建二维数组
data=np.array(iris_list)
# print(data)
print()


df=pd.read_csv("E:\python001\python练习\iris.csv")
a1=df["Sepal.Length"].to_numpy()
a2=df["Petal.Length"].to_numpy()

# 合并数据
he=np.concatenate([a1,a2])
# 排序
paixu=np.sort(he)
# 去重
quchong=np.unique(he)
# 和
sum=np.sum(quchong)
# 均值
ave=np.mean(quchong)
# 标准差
cha=np.std(quchong)
# 方差
var=np.var(quchong)
# 最小值
min=np.min(quchong)
# 最大值
max=np.max(quchong)

print("排序的数据:",paixu,)
print("去重的数据:",quchong,)
print("求和的数据:",he,)
print("平均值:",ave,)
print("标准差:",cha,)
print("方差:",var,)
print("最小值:",min,)
print("最大值:",max,)